import request from '@/utils/request'

/**
 * 获取楼宇列表
 *
 * @param { page, pageSize, name } params
 *
 * @returns {Promise}
 */
export function getBuildingListAPI(params) {
  return request({
    url: '/park/building',
    method: 'get',
    params
  })
}

/**
 * 获取楼宇详情
 *
 * @param { id } id
 *
 * @returns {Promise}
 */
export function getBuildingDetailsAPI(id) {
  return request({
    url: `/park/building/${id}`,
    method: 'get'
  })
}

/**
 * 新增楼宇
 *
 * @param { name, floors, area, propertyFeePrice } data
 *
 * @returns {Promise}
 */
export function addBuildingAPI(data) {
  return request({
    url: '/park/building',
    method: 'post',
    data
  })
}

/**
 * 修改楼宇
 *
 * @param { id, name, floors, area, propertyFeePrice } data
 *
 * @returns {Promise}
 */
export function updateBuildingAPI(data) {
  return request({
    url: '/park/building',
    method: 'put',
    data
  })
}

/**
 * 删除楼宇
 *
 * @param { id } id
 *
 * @returns {Promise}
 */
export function deleteBuildingAPI(id) {
  return request({
    url: `/park/building/${id}`,
    method: 'delete'
  })
}

/**
 * 查看可租赁的楼宇列表
 *
 * @returns {Promise}
 */
export function getUnrentedBuildingAPI() {
  return request({
    url: '/park/rent/building',
    method: 'GET'
  })
}
